** CHANGE DIRECTORY TO YOUR WORKING DIRECTORY
global dir "C:\Users\che-y\Dropbox\Shared\Research\Residential Water\"

global analyze "$dir\Analyze"
global data "$dir\Data"
global results "$dir\Results"

cd "$data"

set matsize 10000

capture drop program drop leveleffects 
program leveleffects
	keep if treated == 1
	keep if treat == 0
	egen pre = mean(water), by(home)
	gen effecthelp = (exp(_b[treat])-1)*(water+1)
	egen effect = mean(effecthelp), by(home)
	duplicates drop home, force
	sum pre
	global prem = r(mean)
	sum effect
	global effectm = r(mean)
	global transbeta = $effectm/$prem*100
end

